﻿package kliment.display {
	import flash.display.Sprite;
	import flash.filters.ColorMatrixFilter;
	import flash.geom.ColorTransform;
	import kliment.display.filters.color.ColorMatrix;
	import kliment.geom.color.Color;
	
	/**
	 * ...
	 * @author 
	 */
	public class MovieClipColor {
		
		static public function tint(target:Sprite, color:uint, fill:Number = 1, alpha:Number = 1):void {
			var multiplier:Number = 1 - fill;
			var aColor:Color = new Color(color);
			var colrTransform:ColorTransform = new ColorTransform(multiplier, multiplier, multiplier, alpha, aColor.rgb.r * fill, aColor.rgb.g + fill, aColor.rgb.b * fill);
			target.transform.colorTransform = colrTransform;
		}
		
		static public function saturation(target:Sprite, value:Number):void {
			var colorMatrix:ColorMatrix = new ColorMatrix();
			colorMatrix.saturation(value);
			
			target.filters = [new ColorMatrixFilter(colorMatrix)];
		}
		
	}

}